<template>
  <div class="cart">
    <!-- 导航栏 -->
    <nav-bar class='nav-bar'>
      <div slot='center'>购物车({{length}})</div>
    </nav-bar>

    <!-- 商品列表 -->
    <cart-list/>

    <!-- 底部汇总 -->
    <cart-bottom-bar />
  </div>
</template>

<script>
import NavBar from 'components/common/navbar/NavBar'

import CartList from './childComps/CartList.vue'
import CartBottomBar from './childComps/CartBottomBar.vue'

// 导入映射 辅助函数
import { mapGetters} from 'vuex'

export default {
  name: 'Cart',
  components:{
    NavBar,
    CartList,
    CartBottomBar
  },
  data() {
    return {
    }
  },
  created(){},
  mounted(){},
  watch:{},
  computed:{
    // 映射  两种用法 
    // ...mapGetters(['要转换为计算属性的 getters'])                  数组用法
    // ...mapGetters({自定义的名字: '要转换为计算属性的 getters'})     对象写法
    ...mapGetters({
      length: 'cartLength'
    })
  },
  methods:{},
}
</script>
<style scoped>
.cart {
  height: 100vh;
}
.nav-bar {
  background-color: var(--color-tint);
  color: #fff;
  font-weight: 700;
}

</style>